package com.aurifa.struts2.plugin.image.component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ui.AbstractUITag;

import com.opensymphony.xwork2.util.ValueStack;

public class ImageTag extends AbstractUITag {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1867044199924596898L;


	private String alt, src;

	private Integer height, width;
	
	private boolean resize, refresh;

	

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.opensymphony.webwork.views.jsp.ComponentTagSupport#populateParams()
	 */
	protected void populateParams() {
		// TODO Auto-generated method stub
		super.populateParams();
		Image i = (Image) component;
		i.setAlt(alt);
		i.setSrc(src);
		i.setHeight(height);
		i.setWidth(width);
		i.setResize(resize);
		i.setRefresh(refresh);
	}

	public Component getBean(ValueStack stack, HttpServletRequest req,
			HttpServletResponse res) {
		return new Image(stack, req, res);
	}
	
	/**
	 * @param refresh The refresh to set.
	 */
	public void setRefresh(boolean refresh) {
		this.refresh = refresh;
	}

	/**
	 * @param thumbnail The thumbnail to set.
	 */
	public void setResize(boolean thumbnail) {
		this.resize = thumbnail;
	}

	/**
	 * @param alt
	 *            The alt to set.
	 */
	public void setAlt(String alt) {
		this.alt = alt;
	}

	/**
	 * @param height
	 *            The height to set.
	 */
	public void setHeight(Integer height) {
		this.height = height;
	}

	/**
	 * @param src
	 *            The src to set.
	 */
	public void setSrc(String src) {
		this.src = src;
	}

	/**
	 * @param width
	 *            The width to set.
	 */
	public void setWidth(Integer width) {
		this.width = width;
	}

}
